home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / net / tf02.lha / TinyFugue / tf-lib / quoter.tf < prev    next >
Text File  |  1995-08-12  |  2KB  |  55 lines

  1. ;;;; Quoting utilities
  2. ;;;
  3. ;;; /qdef   [<prefix>] <name>    - quote a (current) macro definition
  4. ;;; /qmac   [<prefix>] <name>    - quote a macro from a macro file
  5. ;;; /qworld [<prefix>] <name>    - quote a world definition
  6. ;;; /qfile  [<prefix>] <name>    - quote a file
  7. ;;; /qtf    <cmd>        - quote a tf command
  8. ;;; /qsh    <cmd>        - quote a shell command
  9. ;;; /qmud   [-w<world>] <cmd>    - quote a mud command (requires OUTPUTPREFIX
  10. ;;;                  and OUTPUTSUFFIX on the mud)
  11. ;;;
  12. ;;; <prefix> is prepended to each generated line.  The default prefix is ":|",
  13. ;;; but can be changed in /qdef, /qmac, /qworld, and /qfile.
  14.  
  15. /~loaded quoter.tf
  16.  
  17. /require pcmd.tf
  18.  
  19. /def -i qdef = /quote -S %{-L-:|} `/list %{L-@}
  20.  
  21. /set _qmac_files=%{HOME}/.tfrc *.tf tiny.* %{TFLIBDIR}/*.tf
  22.  
  23. /def -i qmac = \
  24.   /setenv prog=\
  25.       /^\\/def.* %L[     ]*=/ { f = 1; } \
  26.       { if (f) print \$0; } \
  27.       /^[^;].*[^\\\\]\$/ { f = 0; }%;\
  28.   /eval /quote -S %{-L-:|} !awk "\\\$prog" `ls %{_qmac_files} 2>/dev/null`
  29.  
  30. /def -i qworld = /quote -S %{-L-:|} `/listworlds %{L-@}
  31.  
  32. /def -i qfile = /quote -S %{-L-:|} '%{L-@}
  33.  
  34. /def -i qtf = :` %*%; /quote -S :| `%*
  35.  
  36. /def -i qsh = :! %*%; /quote -S :| !%*
  37.  
  38. /def -i qmud = \
  39.     /let opts=%; \
  40.     /while ( {1} =/ "-[^- ]*" ) \
  41.         /let opts=%opts %1%; \
  42.         /shift%; \
  43.     /done%; \
  44.     /let dest=${world_name}%; \
  45.     /def %{opts} -ip5000 -msimple -t"%{outputprefix}" -1 -aGg qmud_pre = \
  46.         /def %{opts} -i -hbackground -ag qmud_quiet%%; \
  47.         /send -w%{dest} :| $${world_name}> %*%%; \
  48.         /def %{opts} -ip5001 -mglob -t"*" -aGg qmud_all = \
  49.             /send -w%{dest} :| %%%*%%; \
  50.         /def %{opts} -ip5002 -msimple -t"%{outputsuffix}" -1 -aGg qmud_suf = \
  51.             /edit -i -n1 qmud_quiet%%%; \
  52.             /undef qmud_all%; \
  53.     /pcmd %{opts} %*
  54.  
  55.